const fs = require('fs');
const path = require('path');

const filesToFix = [
    'node_modules/@jiaminghi/data-view/lib/components/decoration3/src/main.vue',
    'node_modules/@jiaminghi/data-view/lib/components/decoration6/src/main.vue'
];

filesToFix.forEach(file => {
    let content = fs.readFileSync(file, 'utf-8');
    content = content.replace(
        /<rect\s+:key="i"/g,
        '<rect'
    );
    content = content.replace(
        /<template v-for="(point, i) in pointList">/g,
        '<template v-for="(point, i) in pointList" :key="i">'
    );
    fs.writeFileSync(file, content, 'utf-8');
    console.log(`Fixed ${file}`);
});
